﻿using AntMovement.Core.Enum;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace AntMovement.WPF.Converter
{
    [ValueConversion(typeof(LogLevel), typeof(Brush))]
    public class MessageLevelToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return Brushes.Black;
            }

            switch ((LogLevel)value)
            {
                case LogLevel.Info: return Brushes.Black;
                case LogLevel.Success: return new SolidColorBrush(Color.FromArgb(0xFF, 0x2B, 0xD6, 0x3D));
                case LogLevel.Warning: return new SolidColorBrush(Color.FromArgb(0xFF, 0xAC, 0xB7, 0x45));
                case LogLevel.Error: return new SolidColorBrush(Color.FromArgb(0xFF, 0xFB, 0x52, 0x52));
                default: return Brushes.Black;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
